package com.briup.jz.web.controller;

import java.util.List;

import javax.validation.constraints.NotNull;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.briup.jz.bean.AccountSystem;
import com.briup.jz.bean.AccountSystemExample;
import com.briup.jz.bean.Category;
import com.briup.jz.bean.Platform;
import com.briup.jz.bean.PlatformExample;
import com.briup.jz.service.ICategoryService;
import com.briup.jz.service.IPlatformService;
import com.briup.jz.utils.Message;
import com.briup.jz.utils.MessageUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(description="平台管理")
@Validated
@RestController
@RequestMapping("/platform")
public class PlatformController {
	 @Autowired
	    private IPlatformService platformservice;
	 @ApiOperation(value = "添加平台信息")
	    @ApiImplicitParams({
	    	    @ApiImplicitParam(name="id",value = "主键",paramType = "form"),
	            @ApiImplicitParam(name="balance",value = "平衡度",paramType = "form"),
	            @ApiImplicitParam(name="bankCard",value = "背景卡",paramType = "form",required = true),
	          
	    })
	    @PostMapping("insert")
	    public Message insert(Platform platform){
		 platformservice.saveOrUpdate(platform);
	        return MessageUtil.success("更新成功");
	    }
		@ApiOperation(value = "修改账户记录")
	    @GetMapping("updateById")
	    public Message updateByPrimaryKey(Platform platform){
			platformservice.saveOrUpdate(platform);
	    	return MessageUtil.success("修改成功");
	    }
		@ApiOperation(value = "查询账户记录")
	    @GetMapping("selectAll")
	    public Message selectAll(PlatformExample platformexample){
			List<Platform> list=platformservice.selectAll(platformexample);
			return MessageUtil.success(list);
	    
	    }
		 	@ApiOperation(value = "通过id删除账户变动")
		    @GetMapping("deleteById")
		    public Message deleteById(Long id){
		 		platformservice.deleteById(id);
		        return MessageUtil.success("删除成功");
		    }
		 @ApiOperation(value = "通过ID查询账户记录")
		    @GetMapping("selectById")
		    public Platform selectById(Long id){
		    	return platformservice.selectById(id);
		    }
	  

	    

}
